<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<?php $this->load->view('admin/partials/subscription_menu'); ?>
	<?php 
		$ci = & get_instance(); 
		$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
		$EMAIL = $ci->email_subscription_entity->init('id',$id);
	?>
	
	<div class="clrboth"></div>
	<h3>SMS Compose</h3>
	<div class="clrboth"></div>

<?php if(!isset($id) || $id == 0): ?>
	<form action="<?php echo site_url('admin/dataman/subscriptions/sms_compose_form_submit');?>" name="email_compose_form_submit" id="email_compose_form_submit" method="post" enctype="multipart/form-data" >
		<div class="grid2"><span class="bold">*Content:</span></div>
		<div class="grid10"><textarea cols="60" rows="10" name="sms_content" id="sms_content" ></textarea></div>
		<div class="grid2"><span class="bold red hidden" id="description_error">Required field.</span></div>
		<div class="clrboth"></div>
		
		<div class="grid2">&nbsp;</div>
		<div class="grid6">
			<input type="button" class="button" value="Save" onclick="sms_compose_save(0);" /> 
			&nbsp;&nbsp;&nbsp;
			<input type="button" class="button" value="Send" onclick="sms_compose_send(0);"/> 
			<?php echo loader_image('id="loader_image" class="hidden"');?>
		</div>
		<div class="clrboth"></div>	
	</form>
<?php else:?>
	<form action="<?php echo site_url('admin/dataman/subscriptions/sms_compose_form_submit');?>" name="email_compose_form_submit" id="email_compose_form_submit" method="post" enctype="multipart/form-data" >
		<div class="grid2"><span class="bold">*Content:</span></div>
		<div class="grid10"><textarea cols="60" rows="10" name="sms_content" id="sms_content" ><?php echo $EMAIL->getSmsContent();?></textarea></div>
		<div class="grid2"><span class="bold red hidden" id="description_error">Required field.</span></div>
		<div class="clrboth"></div>
		
		<div class="grid2">&nbsp;</div>
		<div class="grid6">
			<input type="button" class="button" value="Save" onclick="sms_compose_save(<?php echo $EMAIL->getId();?>);" /> 
			&nbsp;&nbsp;&nbsp;
			<input type="button" class="button" value="Send" onclick="sms_compose_send(<?php echo $EMAIL->getId();?>);"/> 
			<?php echo loader_image('id="loader_image" class="hidden"');?>
		</div>
		<div class="clrboth"></div>	
	</form>
<?php endif;?>
	